home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / intrvews / xgrab.lha / xgrab / include / mymenu.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-04-24  |  1.8 KB  |  83 lines

  1. /**
  2.    GRAB Graph Layout and Browser System
  3.  
  4.    Copyright (c) 1987, 1988, 1989 Stanford University
  5.    Copyright (c) 1989, Tera Computer Company
  6.  **/
  7.  
  8. /*
  9.  * A mymenu is a list of items to select from using the mouse.
  10.  * Just like a menu in InterViews 2.5, except it doesn't pop up in the 
  11.  * same location where it was last time
  12.  */
  13.  
  14. #ifndef mymenu_h
  15. #define mymenu_h
  16.  
  17. #include <InterViews/scene.h>
  18.  
  19. class MyMenu : public MonoScene 
  20. {
  21. public:
  22.     MyMenu(boolean persistent = true);
  23.     MyMenu(const char*, boolean persistent = true);
  24.     MyMenu(Sensor*, Painter*, boolean persistent = true);
  25.     void Compose();
  26.     void GetSelection (Interactor*& i) { i = cur; }
  27.     void Handle(Event&);
  28.     void Popup(Event&, Interactor*&);
  29. protected:
  30.     Scene* layout;
  31.     Interactor* cur;
  32.     Coord xoff, yoff;
  33.  
  34.     void DoInsert(Interactor*, boolean, Coord&, Coord&);
  35. private:
  36.     boolean persistent;
  37.  
  38.     void Init();
  39.     void Reconfig();
  40. };
  41.  
  42. /*
  43.  * A mymenuitem is an interactor that highlights itself when
  44.  * it gets focus, and unhighlights itself when it loses focus.
  45.  */
  46.  
  47. class MyMenuItem : public Interactor {
  48. public:
  49.     int tag;
  50.  
  51.     MyMenuItem(int = 0);
  52.     MyMenuItem(const char*, int = 0);
  53.     MyMenuItem(Painter*, int = 0);
  54.     ~MyMenuItem();
  55.  
  56.     virtual void Handle(Event&);
  57.     virtual void Highlight();
  58.     virtual void UnHighlight();
  59. protected:
  60.     Painter* highlight;
  61.     Painter* normal;
  62.  
  63.     virtual void Reconfig();
  64. private:
  65.     void Init(int);
  66. };
  67.  
  68. class TextItem : public MyMenuItem {
  69. public:
  70.     TextItem(const char*, int = 0);
  71.     TextItem(const char*, const char*, int = 0);
  72.     TextItem(Painter*, const char*, int = 0);
  73. protected:
  74.     const char* text;
  75.  
  76.     virtual void Reconfig();
  77.     virtual void Redraw(Coord, Coord, Coord, Coord);
  78. private:
  79.     void Init(const char*);
  80. };
  81.  
  82. #endif
  83.